package com.sdusoft.service;

import my.mvc.RequestContext;
import my.util.Storage;

/**
 * 文件存储服务
使用方法：
File img = ...;
String path = StorageService.FILES.save(img);
StorageService.FILES.delete(path);
 * @author Winter Lau
 * @date 2010-9-2 上午11:35:56
 */
public class StorageService extends Storage {

	public final static StorageService FILES = new StorageService("files");
	public final static StorageService USERPICS = new StorageService("userpics");
	
	private String file_path;

	private StorageService(String ext){
		this.file_path = RequestContext.root() + 
				"uploads" + java.io.File.separator + 
				ext + java.io.File.separator;
	}
	
	@Override
	protected String getBasePath() {
		return file_path;
	}
	
}
